package router

import (
	"gin-worked/app/common/middleware"
	"gin-worked/app/home"
	"gin-worked/app/system"
	"gin-worked/pkg/logger"
	"github.com/gin-gonic/gin"
)

func Router() *gin.Engine {

	r := gin.Default()

	//几率请求
	r.Use(gin.LoggerWithConfig(logger.LoggerToFile()))
	r.Use(logger.Recover)
	r.Use(middleware.Cors)               //跨域处理
	r.Use(middleware.GetParamMiddleware) //获取接收参数

	home.Router(r) //引入home模块路由

	system.Router(r) //引入后台模块路由

	return r
}
